/**
 * 
 */
package il.ac.bgu.cs.heuristics.graph;

import il.ac.bgu.cs.heuristics.graph.types.IAction;
import il.ac.bgu.cs.heuristics.graph.types.IState;
import il.ac.bgu.cs.heuristics.graph.types.ISubstitution;

import java.util.Collections;
import java.util.Set;

final class GraphAction implements IAction{

	private final IState precondition;
	private final IState effect;

	GraphAction(IState precondition, IState effect) {
		this.precondition = precondition;
		this.effect = effect;

	}

	@Override
	public Set<ISubstitution> getEffect() {
		return Collections.unmodifiableSet(effect.getSubstitutions());
	}

	@Override
	public Set<ISubstitution> getPreconditions() {
		return Collections.unmodifiableSet(precondition.getSubstitutions());
	}

	@Override
	public String toString() {
		return "pre" + precondition.toString() + " effect" + effect.toString()
		        + " End. ";

	}

}